package com.ss.android.image;

import android.os.Process;

import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.b.ThreadPlus;
import com.ss.android.common.util.ToolUtils;

import java.io.File;

public final class d extends ThreadPlus {
    private final BaseImageManager a;

    public d(BaseImageManager arg1, String arg2) {
        super(arg2);
        this.a = arg1;
    }

    public final void run() {
        BaseImageManager v3 = null;
        Process.setThreadPriority(10);
        Logger.i("BaseImageManager", "start clearing cache");
        long v2 = System.currentTimeMillis();
        long v0 = 10000;
        try {
            Thread.sleep(v0);
            v0 = System.currentTimeMillis();
            v3 = this.a;
            ToolUtils.c(v3.mExternalTmpImageDir);
        } catch (Exception ex) {
            Logger.w("BaseImageManager", "clear tmpimages exception: " + ex);
        }

        int v2_2 = 5;
        try {
            BaseImageManager.a(v2_2, new File(v3.mExternalImageDir));
            BaseImageManager.b(5, new File(v3.e));
            if (android.support.design.a.isTextEmpty(v3.mInternalImageDir)) {
//                goto label_30;
            } else {
                BaseImageManager.a(1, new File(v3.mInternalImageDir));
            }
//            goto label_30;
            Logger.i("BaseImageManager", "finish clearing cache, time: " + (System.currentTimeMillis() - v0) + " ms");
            try {
                m.a().a(this.a);
            } catch (Exception v0_1) {
            }
        } catch (Exception ex) {
            Logger.w("BaseImageManager", "clear cache exception " + ex);
        }

    }
}

